import request from '@/utils/request.js'

// 优惠券管理-优惠券列表
export const getCouponList = page => {
  return request({
    url: `/coupon/${page}`
  })
}

// 优惠券管理-增加优惠券
export const createCoupon = data => {
  return request({
    url: '/coupon',
    method: 'post',
    data
  })
}

// 优惠券管理-修改优惠券
export const updateCoupon = (id, data) => {
  return request({
    url: `/coupon/${id}`,
    method: 'post',
    data
  })
}

// 优惠券管理-删除优惠券
export const deleteCoupon = id => {
  return request({
    url: `/coupon/${id}/delete`,
    method: 'post',
  })
}

// 优惠券管理-失效优惠券
export const updateCouponStatus = id => {
  return request({
    url: `/coupon/${id}/update_status`,
    method: 'post',
    data: { status: 0 }
  })
}